package com.bootdo.system.domain;

import lombok.Data;
import lombok.ToString;
import java.math.BigDecimal;
import java.math.RoundingMode;


@Data
@ToString
public class JiaoyiVO {

    //交易策略id
    private Long id;
    //用户id
    private Long userid;
    //币种id
    private Integer bizhongid;
    //持仓金额
    private BigDecimal chicangjine;
    //持仓均价
    private BigDecimal chicangjunjia;
    //补仓次数
    private Integer bucangcishu;
    //持仓数量
    private BigDecimal chicangshuliang;
    //涨幅
    private BigDecimal zhangfu;
    //首单额度
    private BigDecimal firstamount;
    //倍投上限
    private Integer beitoushangxian;
    //止盈比例
    private BigDecimal zhiyingbili;
    //止盈回调
    private BigDecimal zhiyinghuidiao;
    //补仓跌幅
    private BigDecimal bucangdiefu;
    //补仓回调
    private BigDecimal bucanghuidiao;
    //循环策略
    private Integer xunhuantype;
    //策略状态
    private Integer celuestatus;
    //币种名称
    private String bizhongname;
    //当前价格
    private BigDecimal nowprice;
    //备注
    private String beizhu;


    public BigDecimal getFukui(){

        return zhangfu.multiply(chicangjine);
    }

    public String getFukuiStr(){

        return zhangfu.multiply(chicangjine).setScale(6, RoundingMode.HALF_UP).stripTrailingZeros().toPlainString();
    }

    public String getUpname(){
        final int indexOf = bizhongname.indexOf("usdt");
        if(indexOf>=0){
            String lowname = bizhongname.substring(0, indexOf) + "/usdt";
             String upperCase = lowname.toUpperCase();

             return upperCase;
        }

        return bizhongname;
    }

    public String getChicangjinevo(){

        return chicangjine.stripTrailingZeros().toPlainString();
    }

    public String getchicangjunjiavo(){

        return chicangjunjia.stripTrailingZeros().toPlainString();
    }

    public String getchicangshuliangvo(){

        return chicangshuliang.stripTrailingZeros().toPlainString();
    }

    public String getzhangfuvo(){

        return zhangfu.multiply(new BigDecimal(100)).stripTrailingZeros().toPlainString()+"%";
    }

    public String getfirstamountvo(){

        return firstamount.stripTrailingZeros().toPlainString();
    }

    public String getzhiyingbilivo(){

        return zhiyingbili.stripTrailingZeros().toPlainString();
    }

    public String getbucangdiefuvo(){

        return bucangdiefu.stripTrailingZeros().toPlainString();
    }

    public String getzhiyinghuidiaovo(){

        return zhiyinghuidiao.stripTrailingZeros().toPlainString();
    }

    public String getbucanghuidiaovo(){

        return bucanghuidiao.stripTrailingZeros().toPlainString();
    }
}
